package com.awspaas.user.apps.shhtaerospaceindustrial.event;

import com.actionsoft.bpms.dw.design.event.DataWindowFormatDataEventInterface;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;



/**   
* @Title: DWDataFormatEvent.java  
* @Description: 
* @author OnlyWjt
* @date 2019年7月29日 下午8:26:52 
* @version V1.0   
**/
public class DataViewDwQueryDataFormatEvent2 implements DataWindowFormatDataEventInterface {
	public static String objToStr(Object obj) {
		return obj == null ? "" : obj.toString();
	}
	@Override
	public void formatData(UserContext uc, JSONArray datas) {
		try {
			for (Object datao : datas) {//获取值
				JSONObject data = (JSONObject) datao;
				String bindId = data.getString("BINDID");
				String processdefid = "";
				String queryProcessdefid = "SELECT  PROCESSDEFID FROM WFC_PROCESS WHERE ID = '"+bindId+"'";
				processdefid = objToStr(DBSql.getString(queryProcessdefid, "PROCESSDEFID"));
				
				String previewDwDelete = "<button type='button' onClick=\"openDwFormDetail('"+bindId+"','"+processdefid+"');\">查看表单</button>";
				data.put("ISEND", previewDwDelete);//将查看详情格式化
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
